﻿Public Class perRepresentante
    Inherits AcessoBd

    Public Function inserirRepresentante(ByVal sNome As String,
                                          ByVal sEmail As String,
                                          ByVal sEndereco As String,
                                          ByVal sTelefone As String,
                                          ByVal bInativo As Boolean) As Int32
        Dim sSql As String

        sSql = "INSERT INTO representante" & Environment.NewLine &
               "           (nome" & Environment.NewLine &
               "           ,endereco" & Environment.NewLine &
               "           ,email" & Environment.NewLine &
               "           ,telefone" & Environment.NewLine &
               "           ,inativo" & Environment.NewLine &
               ")" & Environment.NewLine &
               "        VALUES" & Environment.NewLine &
               "           (" & Environment.NewLine &
               "            @nome" & Environment.NewLine &
               "           ,@endereco" & Environment.NewLine &
               "           ,@email" & Environment.NewLine &
               "           ,@telefone" & Environment.NewLine &
               "           ,@inativo " & Environment.NewLine &
               "            ); SELECT IDENT_CURRENT('representante')"

        With MyBase.SQLCmd.Parameters
            .Clear()
            .AddWithValue("@nome", sNome)
            .AddWithValue("@endereco", sEndereco)
            .AddWithValue("@email", sEmail)
            .AddWithValue("@telefone", sTelefone)
            .AddWithValue("@inativo", bInativo)
        End With

        Return MyBase.executarConsultaCampo(sSql)

    End Function


End Class
